from .common import *
from wx.lib import itemspicker

# 暂时弃用
class RemovePathDialog(wx.Dialog):
    
    def __init__(self, parent, choices=[], label='', selectedLabel='', title='', context=None, **kwargs):
        wx.Dialog.__init__(self, parent, id = wx.ID_ANY, title = title, size=(660, 350), style=wx.DEFAULT_DIALOG_STYLE|wx.MAXIMIZE_BOX|wx.MINIMIZE_BOX|wx.RESIZE_BORDER)
        self.choices = choices
        self.label = label
        self.selectedLabel = selectedLabel
        self._init_UI()

    def _init_UI(self):
        '''初始化UI'''
        self.panel = wx.Panel(self)
        self.panelSizer = wx.BoxSizer(wx.VERTICAL)
        self.panel.SetSizer(self.panelSizer)

        self.ip = itemspicker.ItemsPicker(self.panel, -1,
            choices = self.choices,
            label = self.label, selectedLabel = self.selectedLabel,
            ipStyle = itemspicker.IP_SORT_CHOICES
            | itemspicker.IP_SORT_SELECTED
            | itemspicker.IP_REMOVE_FROM_CHOICES
        )
        self.ip.Bind(itemspicker.EVT_IP_SELECTION_CHANGED, self.onSelectionChange)
        self.ip._source.SetSize(200, 300)

        if 'wxMac' not in wx.PlatformInfo:
            self.ip.bAdd.SetLabel('-->')
            self.ip.bRemove.SetLabel('<--')

        self.panelSizer.Add(self.ip, 1, wx.ALL, 10)
        self.panel.Fit()

    def onSelectionChange(self, e):
        '''获取选择项'''
        items = e.GetItems()
